using System;
namespace Eisk.Helpers
{
    public static class NullAndEmptyValueExtension
    {
        //DateTime

        public static bool IsEmpty(this DateTime dateTimeData)
        {
            return dateTimeData == DateTime.MinValue;
        }

        public static bool IsEmpty(this DateTime? dateTimeData)
        {
            if (dateTimeData != null)
                return dateTimeData == DateTime.MinValue;

            return false;
        }

        //string 

        public static bool IsEmpty(this string stringData)
        {
            return stringData == string.Empty;
        }

        public static bool IsNull(this string stringData)
        {
            return stringData == null;
        }

        public static bool ContainsValueOrNull(this string stringData, string value)
        {
            return stringData.Contains(value) || (stringData == null);
        }

        public static bool IsInvalidKey(this string value)
        {
            return (value.IsEmpty() || string.IsNullOrWhiteSpace(value));
        }

        
        //byte array

        public static bool IsEmpty(this byte[] byteData)
        {
            if (byteData != null)
                return byteData.Length == 0;

            return false;
        }

        //int

        public static bool IsEmpty(this int intData)
        {
            return intData == 0;
        }

        public static bool IsEmpty(this int? intData)
        {
            if (intData != null)
                return intData == 0;

            return false;
        }

        public static bool IsInvalidKey(this int value)
        {
            return value <=  0;
        }

        //double

        public static bool IsEmpty(this double intData)
        {
            return intData == 0;
        }

        public static bool IsInvalidKey(this double value)
        {
            return value <= 0;
        }

        //guid

        public static bool IsEmpty(this Guid value)
        {
            return value == Guid.Empty;
        }

        public static bool IsEmpty(this Guid? value)
        {
            if (value != null)
                return value == Guid.Empty;

            return false;
        }

        public static bool IsInvalidKey(this Guid value)
        {
            return value.IsEmpty();
        }

        //public static bool IsInvalidKey(this Guid? value)
        //{
        //    if (value != null)
        //        return value.IsInvalidKey();

        //    return true;
        //}
        
    }//end of Employee class
}
